Date: Tue, 05 Nov 1996 00:31:58 GMT
Server: NCSA/1.5
Content-type: text/html
Last-modified: Sat, 07 Sep 1996 23:25:08 GMT
Content-length: 2313

<!--This file created 9/6/96 3:18 PM by Claris Home Page version 1.0b1-->
<HTML>
<HEAD>
   <TITLE>a1hw.html</TITLE>
   <X-SAS-WINDOW TOP=12 BOTTOM=367 LEFT=-675 RIGHT=-145>
</HEAD>
<BODY>

<H1 ALIGN=CENTER><FONT SIZE=5>CS354, Fall 1996</FONT></H1>

<H1 ALIGN=CENTER><FONT SIZE=5>Homework 1, due Wednesday September 18
at the start of class.</FONT></H1>

<H3><TABLE BORDER=1 CELLPADDING=1 WIDTH="100%" HEIGHT=35>
   <TR>
      <TD>
         <P><B><FONT SIZE=4 COLOR="#AF0000">Name
         (printed):</FONT></B>
      </TD><TD>
         <P><B><FONT SIZE=4 COLOR="#AF0000">Name (signed):</FONT></B>
      
      </TD></TR>
</TABLE></H3>

<P>(1) T/F, 10 points, 1 point each</P>

<BLOCKQUOTE><P>Note: The complete SAL instruction set is given in
Appendix A of the textbook, page 386.</P>

<P>(a) all variables in SAL programs are global</P>

<P>(b) the SAL statement "get x" works the same for all types of "x"
</P>

<P>(c) the label "b" could be used for a variable in a SAL program
</P>

<P>(d) variables must be declared before they are used in SAL
programs</P>

<P>(e) when executed, the SAL statement "b (ret)" will cause a branch
to the SAL statement labeled by "ret:"</P>

<P>(f) when executed, the SAL statement "j ret" will cause a branch
to the SAL statement labeled by "ret:"</P>

<P>(g) every SAL program must have a "__start:" label in it somewhere
</P>

<P>(h) "done" is part of the SAL instruction set</P>

<P>(i) "rem" is used to put a remark or comment in a SAL program</P>

<P>(j) type declarations are made in SAL programs so that type
checking can be done by the assembler</P></BLOCKQUOTE>

<P>&nbsp;</P>

<P>(2) 2 points</P>

<BLOCKQUOTE><P>In a single sentence, explain what "computer
architecture" means.</P></BLOCKQUOTE>

<P>&nbsp;</P>

<P>&nbsp;</P>

<P>(3) 8 points</P>

<BLOCKQUOTE><P>Translate the following C code into the equivalent SAL
statements. Assume that all variables are of C type "int."</P>

<P><FONT COLOR="#0000AF">if ((A &gt; 0 ) || ( B == 1 )) {</FONT></P>

<BLOCKQUOTE><P><FONT COLOR="#0000AF">C = A + B * 5;</FONT></P>
</BLOCKQUOTE>

<P><FONT COLOR="#0000AF">} else {</FONT></P>

<BLOCKQUOTE><P><FONT COLOR="#0000AF">A++;</FONT></P>

<P><FONT COLOR="#0000AF">B = ( A / B ) % C;</FONT></P></BLOCKQUOTE>

<P><FONT COLOR="#0000AF">}</FONT></P></BLOCKQUOTE>
</BODY>
</HTML>

